#include <stdio.h>
#include <pthread.h>


void* task(void *p)
{
	int i;
	for(i = 0 ; i < 100 ; ++i)
	{
		if(i == 10)
		{
			pthread_exit((void *)i);	//the same to return
			exit(0);
		}
	}
}

int main()
{
	pthread_t id;
	int x;
	pthread_create(&id , 0, task , 0);
	pthread_join(id,(void **)&x);
	printf("x = %d\n",x);		
}
